package com.bodgittandscarper.broker.types;

import java.io.Serializable;

/**
 * Entity type representing the DatabaseScehme. Type consists of a list of all defined 
 * DatabaseFields.
 * <p> 
 * A {@link DatabaseSchemaMod} interface is also available. 
 * This can be used when adding a new DatabaseField to the DatabaseScheme. This is done when reading the database. 
 * 
 * Type is instantiated through the {@link TypeFactory}.
 * 
 * @author Morten Rummelhoff
 *
 */
public interface DatabaseSchema extends Serializable {

	/**
	 * Fetches the DatabaseField specified by the index.
	 * 
	 * @param index int specifying which <code>DatabaseField</code> to fetch. 
	 * The index is defined as the reading order when initializing
	 * the database.  
	 * 
	 * @return the <code>DatabaseField</code> specified by the index.
	 * @throws ArrayIndexOutOfBoundsException - if no <code>DatabaseField</code> exist for the specified index.
	 */
	public DatabaseField getDatabaseField(int index);
	
	/**
	 * Number of all defined <code>DatabaseField</code> in the Database.
	 * 
	 * @return Number of DatabaseFields in the database
	 */
	public int getDatabaseFieldCount();
	
	
}
